Anatomy of an XML Document

Before we go any farther, let’s look at an example XML document.  
The following document is a sample that stores employee information.

<?xml version=”1.0”?>
<employees>
	<employee id=”A1234”>
		<name>
			<first>John</first>
			<last>Doe</last>
		</name>
		<position>Programmer</position>
		<address>
			<street>123 Main Street</street>
			<city>Anywhere</city>
			<state>CA</state>
			<zip>92000</zip>
		</address>
		<phone>
			<main>(714) 555-1000</main>
			<fax>(714) 555-1001</fax>
		</phone>
	</employee>
</employees>

File: Chapter 2\Employees.xml

As you can see, XML is very easy to read and understand.  If you 
have spent time creating documents in HTML, you can see how 
XML is both similar and very different.  It is similar in the fact that 
it is a markup language and uses tags.  The tags however are not 
HTML tags.  Unlike HTML,  you can create your own tags as we 
have done here.
We can view this document in an XML viewer such as Microsoft’s 
XML Notepad and see the logical structure of our XML document.

File: Chapter 2\Employees.htm in XML Notepad

The Microsoft XML Notepad is available for free from the 
Microsoft site at http://msdn.microsoft.com/xml/notepad/download.asp.  
It is a simple tool for creating and manipulating XML documents.

Another way to view an XML document is by using a browser that 
supports XML such as Internet Explorer 5.0 (IE5).  When we open 
the same XML document using IE5, we get a view more consistent 
with how the document is physically formed.

File: Chapter 2\Employees.htm in IE5

IE5 is also available for free download from the Microsoft web site at http://www.microsoft.com/ie.